Class Global

java.lang.Object
edu.claflin.finder.Global

public final class Global extends Object
Holds "Global" data that needs to be accessed by multiple parts of the program. Should a piece of data, like the LogUtil reference or the output directory, need to be shared by multiple parts of the program it will be stored here. This is a static class and requires no instantiation.
Version:
3.1 May 28, 2015
Author:
Charles Allen Schultz II
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static LogUtil
    The LogUtil reference used for logging data in the program.
    private static File
    The output directory for storing results.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor for preventing instantiation of the class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Destroys the LogUtil reference.
    static LogUtil
    Gets the logger.
    static File
    Gets the output directory for storing results.
    static void
    makeLogger(LogLevel maxGranularity, boolean[] fileLogs, boolean[] terminalLogs)
    Instantiates the logger field.
    static boolean
    Sets the output directory for storing results.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static LogUtil logger
      The LogUtil reference used for logging data in the program.
    • output

      private static File output
      The output directory for storing results. Defaults to the working directory.
  • Constructor Details

    • Global

      private Global()
      Private constructor for preventing instantiation of the class.
  • Method Details

    • makeLogger

      public static void makeLogger(LogLevel maxGranularity, boolean[] fileLogs, boolean[] terminalLogs)
      Instantiates the logger field.
      Parameters:
      maxGranularity - the maximum granularity of the log messages.
      fileLogs - the boolean array indicating file log settings.
      terminalLogs - the boolean array indicating terminal output settings.
    • destroyLogger

      public static void destroyLogger()
      Destroys the LogUtil reference. Calls the destroy() method on the logger field if the logger field is not null.
    • getLogger

      public static LogUtil getLogger()
      Gets the logger.
      Returns:
      the LogUtil reference used for logging in the program.
    • setOutput

      public static boolean setOutput(File file)
      Sets the output directory for storing results.
      Parameters:
      file - the File representing the new output directory.
      Returns:
      a boolean indicating if the output directory was successfully set.
    • getOutput

      public static File getOutput()
      Gets the output directory for storing results.
      Returns:
      the File representing the output directory.